package cn.itcast.up.model.bean

/**
  * Hbase的元数据样例类
  */
case class HBaseMeta(
                      inType: String, //数据源名称
                      zkHosts: String, //zk主机地址
                      zkPort: String, //zk端口号
                      hbaseTable: String, //要查询哪张表
                      family: String, //列簇名字
                      selectFields: String //当前选择的字段
                    )

object HBaseMeta {

  //定义map中的key的名字
  val INTYPE = "inType"
  val ZKHOSTS = "zkHosts"
  val ZKPORT = "zkPort"
  val HBASETABLE = "hbaseTable"
  val FAMILY = "family"
  val SELECTFIELDS = "selectFields"




  def apply(map: Map[String, String]): HBaseMeta = {
    //去map中获取相应的字段,封装为HBaseMeta对象
    val inType: String = map.getOrElse("inType", "")
    val zkHosts: String = map.getOrElse("zkHosts", "")
    val zkPort: String = map.getOrElse("zkPort", "")
    val hbaseTable: String = map.getOrElse("hbaseTable", "")
    val family: String = map.getOrElse("family", "")
    val selectFields: String = map.getOrElse("selectFields", "")
    HBaseMeta(
      inType,
      zkHosts,
      zkPort,
      hbaseTable,
      family,
      selectFields
    )
  }
}